<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            height: 2000px;
        }
        #wrap{
            width: 100%;
            height: 50px;
            background-color: aquamarine;
            text-align: center;
            line-height: 50px;
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 100;
        }
        #box{
            position: relative;
            margin: 500px auto;
            width: 100px;
            height: 100px;
            background-color: pink;
            text-align: center;
            line-height: 100px;
        }
    </style>
</head>
<body>
    <div id="wrap">我是一个导航条</div>
    <div id="box">
        往下滚
    </div>
</body>
<script src="./jquery.js"></script>
<script>
    $(function(){
        var boxOffsetTop = $('#box').offset().top
        // console.log(boxOffsetTop);
        $(window).scroll(function(){
            var scrollTop = $(this).scrollTop();
            if(scrollTop > boxOffsetTop){
                $('#wrap').stop().fadeIn()
            }else{
                $('#wrap').stop().fadeOut()
            }
        })
    })
</script>
</html>